package com.keyancompany.zhongbaopingtai.activity;

import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

import com.keyancompany.zhongbaopingtai.Constants;
import com.keyancompany.zhongbaopingtai.R;
import com.keyancompany.zhongbaopingtai.adapter.PercentAdapter;
import com.keyancompany.zhongbaopingtai.model.TeamRewardModel;

import java.util.ArrayList;

import butterknife.Bind;
import butterknife.BindString;

/**
 * 分配比例
 */
public class FenPeiPercentActivity extends BaseActivity {

    @BindString(R.string.fenpeibili_text)
    String title;
    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.list_view)
    ListView listView;
    @Bind(R.id.task)
    TextView noTask;
    private ArrayList<TeamRewardModel> currentModels;
    private PercentAdapter mPercentAdapter;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_fenpei_percent;
    }

    @Override
    protected int getMenuId() {
        return 0;
    }

    @Override
    protected void initToolBar() {
        initToolBar(toolbar, title);
    }

    @Override
    protected void setUpViews() {
        currentModels = (ArrayList<TeamRewardModel>) getIntent().getExtras().getSerializable(Constants.ITEM);

        mPercentAdapter = new PercentAdapter(mContext, null);

        listView.setAdapter(mPercentAdapter);
        mPercentAdapter.addAllAfter(currentModels);

        if (currentModels == null || currentModels.isEmpty()) {
            listView.setVisibility(View.GONE);
            noTask.setVisibility(View.VISIBLE);
        } else {
            listView.setVisibility(View.VISIBLE);
            noTask.setVisibility(View.GONE);
        }

    }
}
